const fs = require('fs')

//流的方式读取文件

let readStream = fs.createReadStream('input.txt')

let str = ''
let count = 0

readStream.on('data', (chunk) => {
  str += chunk
  count++
})

//读取完成
readStream.on('end', (success) => {
  //console.log(str)
  console.log(count)
})

readStream.on('error', (err) => {
  console.log(err)
})